'use strict';

function grouping_count(collection) {
  let result={};
  for(let i=0;i<collection.length;i++){
    let num=1;
    for(let j=i+1;j<collection.length;j++){
      if(collection[i]==collection[j]){
        num++;
        collection.splice(j,1);
        j--;
      }
    }
    result[collection[i]]=num;
  }
  console.log(result);
  return result;
}

module.exports = grouping_count;
grouping_count([1,1,1,1,2,3,1,3,4,2,3,1,3,4,2]);
